import HTMLParser
import urllib
import re
import string

urlString = "http://www.aaix.at/"
urlText=[]
check=False

class ParseIXP(HTMLParser.HTMLParser):
    def handle_starttag(self,tag,attrs):
        global check
        if tag=="span":
            check=True
            
    def unknown_decl (self, data):
        pass
                                    
    def handle_data(self, data):
        global check
        if data!='\n' and check==True:
            if (re.search("[A][S]\d+", data)):
                data2=data.replace ("\xa0", " ")
                list=re.split('\s', data2)
                for item in list:
                    if (re.search("^[A][S]\d+$", item)):
                        item2=item.replace("AS", "")
                        urlText.append(item2)
        check=False
                    
lparser=ParseIXP()
lparser.feed(urllib.urlopen(urlString).read())
filePath="ixp_members.txt"
file=open(filePath, "a")
for item in urlText:
    #print item
    print >> file, "226 %s" % item
file.close()